\(\int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\) [19]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 110 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=4 a^3 (A-i B) x-\frac {4 a^3 (i A+B) \log (\cos (c+d x))}{d}-\frac {2 a^3 (A-i B) \tan (c+d x)}{d}+\frac {a (i A+B) (a+i a \tan (c+d x))^2}{2 d}+\frac {B (a+i a \tan (c+d x))^3}{3 d} \]

[Out]

4*a^3*(A-I*B)*x-4*a^3*(I*A+B)*ln(cos(d*x+c))/d-2*a^3*(A-I*B)*tan(d*x+c)/d+1/2*a*(I*A+B)*(a+I*a*tan(d*x+c))^2/d
+1/3*B*(a+I*a*tan(d*x+c))^3/d

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3608, 3559, 3558, 3556} \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {2 a^3 (A-i B) \tan (c+d x)}{d}-\frac {4 a^3 (B+i A) \log (\cos (c+d x))}{d}+4 a^3 x (A-i B)+\frac {a (B+i A) (a+i a \tan (c+d x))^2}{2 d}+\frac {B (a+i a \tan (c+d x))^3}{3 d} \]

[In]

Int[(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

4*a^3*(A - I*B)*x - (4*a^3*(I*A + B)*Log[Cos[c + d*x]])/d - (2*a^3*(A - I*B)*Tan[c + d*x])/d + (a*(I*A + B)*(a
 + I*a*Tan[c + d*x])^2)/(2*d) + (B*(a + I*a*Tan[c + d*x])^3)/(3*d)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rule 3559

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + b*Tan[c + d*x])^(n - 1)/(d*(n - 1))
), x] + Dist[2*a, Int[(a + b*Tan[c + d*x])^(n - 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && G
tQ[n, 1]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {B (a+i a \tan (c+d x))^3}{3 d}-(-A+i B) \int (a+i a \tan (c+d x))^3 \, dx \\ & = \frac {a (i A+B) (a+i a \tan (c+d x))^2}{2 d}+\frac {B (a+i a \tan (c+d x))^3}{3 d}+(2 a (A-i B)) \int (a+i a \tan (c+d x))^2 \, dx \\ & = 4 a^3 (A-i B) x-\frac {2 a^3 (A-i B) \tan (c+d x)}{d}+\frac {a (i A+B) (a+i a \tan (c+d x))^2}{2 d}+\frac {B (a+i a \tan (c+d x))^3}{3 d}+\left (4 a^3 (i A+B)\right ) \int \tan (c+d x) \, dx \\ & = 4 a^3 (A-i B) x-\frac {4 a^3 (i A+B) \log (\cos (c+d x))}{d}-\frac {2 a^3 (A-i B) \tan (c+d x)}{d}+\frac {a (i A+B) (a+i a \tan (c+d x))^2}{2 d}+\frac {B (a+i a \tan (c+d x))^3}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.87 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.66 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {B (a+i a \tan (c+d x))^3+\frac {3}{2} a^3 (i A+B) \left (8 \log (i+\tan (c+d x))+6 i \tan (c+d x)-\tan ^2(c+d x)\right )}{3 d} \]

[In]

Integrate[(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

(B*(a + I*a*Tan[c + d*x])^3 + (3*a^3*(I*A + B)*(8*Log[I + Tan[c + d*x]] + (6*I)*Tan[c + d*x] - Tan[c + d*x]^2)
)/2)/(3*d)

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.91

method result size
derivativedivides \(\frac {a^{3} \left (-\frac {i B \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {i A \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 i B \tan \left (d x +c \right )-\frac {3 B \left (\tan ^{2}\left (d x +c \right )\right )}{2}-3 A \tan \left (d x +c \right )+\frac {\left (4 i A +4 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 i B +4 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(100\)
default \(\frac {a^{3} \left (-\frac {i B \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {i A \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 i B \tan \left (d x +c \right )-\frac {3 B \left (\tan ^{2}\left (d x +c \right )\right )}{2}-3 A \tan \left (d x +c \right )+\frac {\left (4 i A +4 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 i B +4 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(100\)
norman \(\left (-4 i B \,a^{3}+4 A \,a^{3}\right ) x -\frac {\left (i A \,a^{3}+3 B \,a^{3}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}-\frac {\left (-4 i B \,a^{3}+3 A \,a^{3}\right ) \tan \left (d x +c \right )}{d}-\frac {i B \,a^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 \left (i A \,a^{3}+B \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(117\)
parallelrisch \(\frac {-2 i B \left (\tan ^{3}\left (d x +c \right )\right ) a^{3}-3 i A \left (\tan ^{2}\left (d x +c \right )\right ) a^{3}-24 i B x \,a^{3} d +12 i A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{3}+24 A x \,a^{3} d +24 i B \tan \left (d x +c \right ) a^{3}-9 B \left (\tan ^{2}\left (d x +c \right )\right ) a^{3}-18 A \tan \left (d x +c \right ) a^{3}+12 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{3}}{6 d}\) \(128\)
risch \(\frac {8 i a^{3} B c}{d}-\frac {8 a^{3} A c}{d}-\frac {2 a^{3} \left (12 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+24 B \,{\mathrm e}^{4 i \left (d x +c \right )}+21 i A \,{\mathrm e}^{2 i \left (d x +c \right )}+33 B \,{\mathrm e}^{2 i \left (d x +c \right )}+9 i A +13 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}-\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}\) \(145\)
parts \(A \,a^{3} x +\frac {\left (-i A \,a^{3}-3 B \,a^{3}\right ) \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (3 i A \,a^{3}+B \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (3 i B \,a^{3}-3 A \,a^{3}\right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}-\frac {i B \,a^{3} \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(149\)

[In]

int((a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*a^3*(-1/3*I*B*tan(d*x+c)^3-1/2*I*A*tan(d*x+c)^2+4*I*B*tan(d*x+c)-3/2*B*tan(d*x+c)^2-3*A*tan(d*x+c)+1/2*(4*
I*A+4*B)*ln(1+tan(d*x+c)^2)+(-4*I*B+4*A)*arctan(tan(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.59 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (12 \, {\left (i \, A + 2 \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (7 i \, A + 11 \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (9 i \, A + 13 \, B\right )} a^{3} + 6 \, {\left ({\left (i \, A + B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (i \, A + B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (i \, A + B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (i \, A + B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate((a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-2/3*(12*(I*A + 2*B)*a^3*e^(4*I*d*x + 4*I*c) + 3*(7*I*A + 11*B)*a^3*e^(2*I*d*x + 2*I*c) + (9*I*A + 13*B)*a^3 +
 6*((I*A + B)*a^3*e^(6*I*d*x + 6*I*c) + 3*(I*A + B)*a^3*e^(4*I*d*x + 4*I*c) + 3*(I*A + B)*a^3*e^(2*I*d*x + 2*I
*c) + (I*A + B)*a^3)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2
*I*d*x + 2*I*c) + d)

Sympy [A] (verification not implemented)

Time = 0.39 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.67 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=- \frac {4 i a^{3} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 18 i A a^{3} - 26 B a^{3} + \left (- 42 i A a^{3} e^{2 i c} - 66 B a^{3} e^{2 i c}\right ) e^{2 i d x} + \left (- 24 i A a^{3} e^{4 i c} - 48 B a^{3} e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} + 3 d} \]

[In]

integrate((a+I*a*tan(d*x+c))**3*(A+B*tan(d*x+c)),x)

[Out]

-4*I*a**3*(A - I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/d + (-18*I*A*a**3 - 26*B*a**3 + (-42*I*A*a**3*exp(2*I*c) -
 66*B*a**3*exp(2*I*c))*exp(2*I*d*x) + (-24*I*A*a**3*exp(4*I*c) - 48*B*a**3*exp(4*I*c))*exp(4*I*d*x))/(3*d*exp(
6*I*c)*exp(6*I*d*x) + 9*d*exp(4*I*c)*exp(4*I*d*x) + 9*d*exp(2*I*c)*exp(2*I*d*x) + 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 96, normalized size of antiderivative = 0.87 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {2 i \, B a^{3} \tan \left (d x + c\right )^{3} + 3 \, {\left (i \, A + 3 \, B\right )} a^{3} \tan \left (d x + c\right )^{2} - 24 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{3} + 12 \, {\left (-i \, A - B\right )} a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (3 \, A - 4 i \, B\right )} a^{3} \tan \left (d x + c\right )}{6 \, d} \]

[In]

integrate((a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/6*(2*I*B*a^3*tan(d*x + c)^3 + 3*(I*A + 3*B)*a^3*tan(d*x + c)^2 - 24*(d*x + c)*(A - I*B)*a^3 + 12*(-I*A - B)
*a^3*log(tan(d*x + c)^2 + 1) + 6*(3*A - 4*I*B)*a^3*tan(d*x + c))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 312 vs. \(2 (94) = 188\).

Time = 0.46 (sec) , antiderivative size = 312, normalized size of antiderivative = 2.84 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (6 i \, A a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 6 \, B a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 i \, A a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, B a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 i \, A a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, B a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 12 i \, A a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 24 \, B a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 21 i \, A a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 33 \, B a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 6 i \, A a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 6 \, B a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 9 i \, A a^{3} + 13 \, B a^{3}\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate((a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-2/3*(6*I*A*a^3*e^(6*I*d*x + 6*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 6*B*a^3*e^(6*I*d*x + 6*I*c)*log(e^(2*I*d*x
+ 2*I*c) + 1) + 18*I*A*a^3*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 18*B*a^3*e^(4*I*d*x + 4*I*c)*log
(e^(2*I*d*x + 2*I*c) + 1) + 18*I*A*a^3*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 18*B*a^3*e^(2*I*d*x
+ 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 12*I*A*a^3*e^(4*I*d*x + 4*I*c) + 24*B*a^3*e^(4*I*d*x + 4*I*c) + 21*I*A
*a^3*e^(2*I*d*x + 2*I*c) + 33*B*a^3*e^(2*I*d*x + 2*I*c) + 6*I*A*a^3*log(e^(2*I*d*x + 2*I*c) + 1) + 6*B*a^3*log
(e^(2*I*d*x + 2*I*c) + 1) + 9*I*A*a^3 + 13*B*a^3)/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*
I*d*x + 2*I*c) + d)

Mupad [B] (verification not implemented)

Time = 7.86 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.14 \[ \int (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,a^3}{2}+\frac {a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )}{2}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (4\,B\,a^3+A\,a^3\,4{}\mathrm {i}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a^3\,1{}\mathrm {i}-a^3\,\left (2\,A-B\,1{}\mathrm {i}\right )+a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{d}-\frac {B\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}}{3\,d} \]

[In]

int((A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

(log(tan(c + d*x) + 1i)*(A*a^3*4i + 4*B*a^3))/d - (tan(c + d*x)^2*((B*a^3)/2 + (a^3*(A*1i + 2*B))/2))/d + (tan
(c + d*x)*(B*a^3*1i - a^3*(2*A - B*1i) + a^3*(A*1i + 2*B)*1i))/d - (B*a^3*tan(c + d*x)^3*1i)/(3*d)